

#include <galite/garandom.h>
#include <galite/GASelector.h>
#include <galite/GAPopulation.h>

#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;

#ifdef USE_MPI
#include <mpi.h>
#endif

#include <assert.h>
#include <math.h>

#ifndef SIMPLE_GA_CLASS
#define SIMPLE_GA_CLASS

class SimpleGA {

  protected:
  GASelectionScheme *selectsch;
  GAPopulation *pop;
  GAPopulation *pop0;
  float pcross;
  float pmut;
  GARandom *randObj;


  public:
  
  SimpleGA(const GAGenome *c, unsigned int psize, 
		 float crossx, float mut, GARandom* randObj)
	{
	this->randObj = randObj;
     	pop = new GAPopulation(c, psize);
     	pop0 = new GAPopulation();
	pop0->initialize(c, psize);
	pcross = crossx;
	pmut = mut; 
	}

  GARandom *getRandObj()
	{
	 return randObj;
	}

  void selector(GASelectionScheme *scheme) {
	this->selectsch = scheme;
	this->selectsch->setRandomObj(randObj);
	this->selectsch->update(pop);
	}

  const GAPopulation& population() {
	return *pop;
	}

  virtual void step();
};


#endif
